﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;
using DataAccess;
using System.Data;
using Entities;

namespace MedicareNoteManagerWeb
{
    public class BasePage:System.Web.UI.Page
    {
        public BasePage()
        {

        }
        /// <summary>
        /// 绑定下拉菜单数据
        /// </summary>
        /// <param name="ProStr">存储过程名</param>
        /// <param name="valueID">下拉值</param>
        /// <param name="textID">展示值</param>
        /// <param name="allName">第一行数据名称</param>
        /// <param name="dropdownlist">控件</param>
        public void FillDropDownList(string ProStr,string valueID,string textID,string allName,DropDownList dropdownlist)
        {
            DataSet ds = new DataSet();
            ds = DbHelperMySql.RunProcedure(ProStr);
            dropdownlist.DataTextField = textID;
            dropdownlist.DataValueField = valueID;
            dropdownlist.DataSource = ds.Tables[0];
            dropdownlist.DataBind();
            dropdownlist.Items.Insert(0, new ListItem(allName, "0"));
        }
        public DataRowCollection GetMenuList(int parentid)
        {
            DataSet ds = new DataSet();
            ds = DbHelperMySql.Query("select * from sys_menu where MenuParentNo="+parentid);
            return ds.Tables[0].Rows;

        }
        public sys_user_Model GetUserModel()
        {
            sys_user_Model model =(sys_user_Model)Session["UserModel"];
            return model;
        }
    }
}